#!/bin/bash

#关闭防火墙

systemctl stop firewalld.service 
systemctl disable firewalld.service

#关闭selinux
setenforce 0
sed -i 's/enforcing/disabled/g' /etc/selinux/config


#设定时间同步
yum -y install chrony
systemctl start chronyd && systemctl enable chronyd
timedatectl set-timezone Asia/Shanghai && timedatectl set-ntp yes

#交换空间请根据实际情况关闭
swapoff -a

# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 bash-c*
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装Docker-CE
yum makecache  
#yum -y install docker-ce
yum -y install docker-ce-18.09.9-3.el7 docker-ce-cli-18.09.9
#sudo yum -y install docker-ce-17.12.1.ce-1.el7.centos
# Step 4: 开启Docker服务
systemctl start docker
systemctl enable docker
 
#echo -e '{\n"registry-mirrors": ["https://mj9kvemk.mirror.aliyuncs.com"]\n}' >> /etc/docker/daemon.json
#echo -e '{\n"registry-mirrors": ["https://64ulnat1.mirror.aliyuncs.com"]\n}' >> /etc/docker/daemon.json

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://64ulnat1.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker




